<template>
  <div class="detail">
    <h2>detail-id={{ id }}</h2>
  </div>
</template>

<script setup lang="ts">
  const route = useRoute();
  const { id } = route.params;

  /**
   * definePageMeta方法: 定义页面元信息
   * validate: 验证路由
   * 返回一个对象，包含statusCode和statusMessage
   */
  definePageMeta({
    validate: (route) => {
      console.log(route.params.id);
      return {
        statusCode: 404,
        statusMessage: "validata router error",
      };
    },
  });
</script>

<style lang="less" scoped>
  .detail {
  }
</style>
